import java.util.Scanner;

import javax.swing.JOptionPane;
public class CircleTest {
	
	
	 public static void main(String[] args) {
		 	
	        double x, y;
	        Point testPoint;
	        double radius; 
	        Circle testCircle;
	        String input;
	        int count = 0;
	 
	        //ask the user if they would like to create a circle. The user should enter "yes" or "no"
	      input=JOptionPane.showInputDialog(null, "Would you like to make a circle? (Yes/No) ");

	 
	        //loop as long as the user enters yes
	        	while(!input.equalsIgnoreCase("no")){
	        		
	        
	               //check to see if use entered "yes"
	                               //get coordinates for point from the user (use JOptionPane)
	 
	        		String xCord=JOptionPane.showInputDialog(null, "Please enter the x coordinate for the point on the circle.");
	        		String yCord=JOptionPane.showInputDialog(null, "Please enter the y coordinate for the point on the circle.");
	        		
	        		x=Double.parseDouble(xCord);
	        		y=Double.parseDouble(yCord);
	 
	                               //create and initialize a point
	        		testPoint=new Point(x,y);
	 
	 
	                               //create and initialize the circle
	        		String stringRadius=JOptionPane.showInputDialog(null, "Please enter the radius of the circle:");
	        		radius=Double.parseDouble(stringRadius);
	        			testCircle=new Circle(radius, testPoint);
	        			
	        			double area=testCircle.getArea();
	        			double perimeter=testCircle.getPerimeter();
	 
	 
	 
	                               //Display the information about the circle:
	                               //the central point coordinates, area, and perimeter. 
	        			JOptionPane.showMessageDialog(null, "The coordinates of the point in the circle are ("+x+","+y+"), the area" +
	        					" is "+area+", and the perimeter is "+perimeter+".");
	        			
	        			input=JOptionPane.showInputDialog(null, "Would you like to create another circle? (Yes/No)");
	 
	        			count++;
	            //end loop
	        	}
	       //display how many Circle Objects were created (use JOptionPane to do this too)
	        	JOptionPane.showMessageDialog(null, "You created "+count +" circles.");
	        	JOptionPane.showMessageDialog(null, "Thank you for using the program. Goodbye.");
	 
	  }


	
}
